/*
 * @Author: ailin
 * @Date: 2022-11-26 17:00:49
 * @LastEditors: ailin
 * @LastEditTime: 2022-11-26 17:01:11
 * @Description: file content
 * @FilePath: /HealthRecords/src/utils/storage.js
 */
export const getItem = (name) => {
  const data = window.localStorage.getItem(name)
  try {
    return JSON.parse(data)
  } catch (err) {
    return data
  }
}

export const setItem = (name, value) => {
  if (typeof value === "object") {
    value = JSON.stringify(value)
  }

  window.localStorage.setItem(name, value)
}

export const removeItem = (name) => {
  window.localStorage.removeItem(name)
}
